package com.smart.campus.school.service;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class ServerTCP {
    public static void main(String[] args) throws IOException {
        System.out.println("客户端 发送数据");
        // 1.创建 Socket ( ip , port ) , 确定连接到哪里.
       Socket client = new Socket("localhost", 50000);
        // 2.获取流对象 . 输出流
        InputStream os = client.getInputStream();
        // 3.写出数据.
      //  os.write("你好么? tcp ,我来了".getBytes());
        os.read();
        // 4. 关闭资源 .
        os.close();
        client.close();
    }
}